<template>
  <el-dialog
    append-to-body
    :before-close="cancel"
    :visible.sync="value">
    <template slot="title">
      {{title}}
    </template>
    <el-form :data="rowData">
      <el-form-item label="一审状态">
        <el-input @keyup.enter.native="cancel" v-model="rowData.auditFirStatus" disabled></el-input>
      </el-form-item>
      <el-form-item label="一审备注">
        <el-input @keyup.enter.native="cancel" type="textarea" rows="3" v-model="rowData.auditFirComment" disabled></el-input>
      </el-form-item>
      <div v-if="step === 2">
        <el-form-item label="二审状态">
          <el-input @keyup.enter.native="cancel" v-model="rowData.auditSecStatus" disabled></el-input>
        </el-form-item>
        <el-form-item label="二审备注">
          <el-input @keyup.enter.native="cancel" type="textarea" v-model="rowData.auditSecComment" rows="3" disabled></el-input>
        </el-form-item>
      </div>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="cancel">确认</el-button>
    </div>
  </el-dialog>

</template>

<script>
  import {form} from '@/build'

  export default {
    name: "commission-audit-view-dialog",
    props: ['value', 'rowData', 'step'],
    mixins: [form],
    data() {
      return {}
    },
    methods: {
      auditSuccess() {
        this.form.auditStatus = 1
        this.doSave({action: 'saveForm', form: 'refForm'})
        this.cancel()
      },
      cancel() {
        this.$emit('input', false);
      },
      auditRefuse() {
        this.form.auditStatus = 2
        this.doSave({action: 'saveForm', form: 'refForm'})
        this.cancel();
      }
    },
    computed: {
      title() {
        if (this.step === 1) {
          return '初审'
        }
        return '终审'
      }
    },
    mounted() {
      this.bindSave(updateAuditStatus, 'saveForm', 'form', {})
    }
  }
</script>

<style scoped>

</style>
